import {  } from "vant";
import { addOrder } from "../../request/api";

const state = {
    data: {
        uid:"",
        username:"",
        userphone:"",
        useraddress:"",
        countmoney:"",
        countnumber:"",
        addtime:"",
        idstr:"", 
    },
   

}

// 2,声明mutations
const mutations = {
    // 专门来修改goods数据
    changedata(state, data) {
        state.data = data
    },
    changecountmoney(state,data){
        state.data.countmoney=data
    },
    changecountnumber(state,data){
        state.data.countnumber=data
    },
    // changealldata(state, data) {
    //     state.alldata = data
    // },
   

}

// 3.声明actions
const actions = {
    addActions(context,obj){
        console.log(222);
        addOrder(obj).then(res=>{
            console.log(123);
            if(res.code==200){
                console.log(res);
            }
        })
    },
    countmoneyActions(context,a){
        context.commit('changecountmoney',a)
    },
    countnumberActions(context,a){
        context.commit('changecountnumber',a)
    },
    alldataActions(context,obj){
        context.commit('chobjngealldata',obj)
    }

}
// 4.声明getters
const getters = {
    data(state) {
        return state.data
    },
    countmoney(state) {
        return state.countmoney
    },
    countnumber(state) {
        return state.countnumber
    },
    // alldata(state) {
    //     return state.alldata
    // },
    
}

export default {
    state,
    mutations,
    actions, getters,
    namespaced: true,//使用命名
}